#ifndef _DEBUG_H_
#define _DEBUG_H_

#include "printk.h"

/* RTOS debug global enable signal */
#define RTOS_DEBUG_ENBALE                   1

/* RTOS scheduler debug enable and configuration level */
#define SCHED_DEBUG_LEVEL                   0
#define SCHED_DEBUG_ENABLE                  0

/* RTOS chip debug enable and configuration level */
#define CHIP_DEBUG_LEVEL                    0
#define CHIP_DEBUG_LEVEL_ENABLE             0

/* RTOS HAL debug enable and configuration level */
#define HAL_DEBUG_LEVEL                     0
#define HAL_DEBUG_LEVEL_ENABLE              0

/* RTOS SHELL debug enable and configuration level */
#define SHELL_DEBUG_LEVEL                   0
#define SHELL_DEBUG_LEVEL_ENABLE            0

/* RTOS STDLIB debug enable and configuration level */
#define STDLIB_DEBUG_LEVEL                  0
#define STDLIB_DEBUG_LEVEL_ENABLE           0

#define PTHREAD_DEBUG_LEVEL                 0

#define SEM_DEBUG_LEVEL                     0

/* RTOS scheduler debug interface */
#define SCHED_DEBUG(level, ...) \
    if (level > SCHED_DEBUG_LEVEL && RTOS_DEBUG_ENBALE) \
        printk(__VA_ARGS__);

/* RTOS chip debug interface */
#define CHIP_DEBUG(level, ...) \
    if (level > CHIP_DEBUG_LEVEL && RTOS_DEBUG_ENBALE) \
        printk(__VA_ARGS__);

/* RTOS HAL debug interface */
#define HAL_DEBUG(level, ...) \
    if (level > HAL_DEBUG_LEVEL && RTOS_DEBUG_ENBALE) \
        printk(__VA_ARGS__);

/* RTOS HAL debug interface */
#define SHELL_DEBUG(level, ...) \
    if (level > SHELL_DEBUG_LEVEL && RTOS_DEBUG_ENBALE) \
        printk(__VA_ARGS__);

/* RTOS HAL debug interface */
#define STDLIB_DEBUG(level, ...) \
    if (level > STDLIB_DEBUG_LEVEL && RTOS_DEBUG_ENBALE) \
        printk(__VA_ARGS__);

/* assert signal result */
#define ASSERT_KERNEL(signal)                                                         \
{                                                                                     \
    if (!(signal))                                                                    \
    {                                                                                 \
        volatile bool dummy = true;                                                   \
        printk("(%s) assert failed at %s:%d .\r\n", #signal, __FUNCTION__, __LINE__); \
        while(true == dummy);                                                         \
    }                                                                                 \
}

#endif
